

#include "ltdb.h"
#include "utl.h"



void
lt_time_now(
    lt_time_t*  time
)
{
    struct tm*      newtime;
    struct timeb	curtime;

    ftime(&curtime);

    newtime = localtime(&curtime.time);

    time->year    = newtime->tm_year + 1900;
    time->month   = newtime->tm_mon + 1;
    time->day     = newtime->tm_mday;
    time->hour    = newtime->tm_hour;
    time->minute  = newtime->tm_min;
    time->second  = newtime->tm_sec;
    time->msec    = curtime.millitm;
}

void
lt_time_now_str(
    schar time_str[64]
)
{
    lt_time_t  time;

    lt_time_now(&time);

    sprintf(time_str, "%04d-%02d-%02d %02d:%02d:%02d.%06d", 
            time.year, 
            time.month, 
            time.day, 
            time.hour, 
            time.minute, 
            time.second, 
            time.msec);
}